package com.example.method1;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @program: springboot_course
 * @description:
 * @author: ChenZhiXiang
 * @create: 2019-08-06 20:02
 **/
@RestController
public class MethodMain {

    /**注入普通字符串*/
    @Value("陈志翔")
    private String str;

    /** 配置文件的变量 */
    @Value("${czx.wt}")
    private String czx;

    /** 注入操作系统属性 */
    @Value("#{systemProperties['os.name']}")
    private String systemPropertiesName;

    @GetMapping("/a")
    public Object a(){
        Map<String,Object> map = new HashMap<>();
        map.put("a",str);
        map.put("b",czx);
        map.put("c",systemPropertiesName);
        return map;
    }
}
